package com.bw.user.task;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.internal.OSSUtils;
import com.bw.user.config.OSSBootUtil;
import com.bw.user.service.TbIdentityAuthService;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;

public class UploadTask implements Callable<Map> {

    private MultipartFile IdCardBank;
    private MultipartFile livePic;
    private MultipartFile IdCardFront;
    private TbIdentityAuthService identityAuthService;

    public UploadTask(MultipartFile idCardBank, MultipartFile livePic, MultipartFile idCardFront, TbIdentityAuthService identityAuthService) {
        IdCardBank = idCardBank;
        this.livePic = livePic;
        IdCardFront = idCardFront;
        this.identityAuthService = identityAuthService;
    }

    @Override
    public Map<String,String> call() throws Exception {
        Thread.sleep(2000);

        String IdCardBank_url = OSSBootUtil.upload(IdCardBank,"F:/file");
        String livePic_url = OSSBootUtil.upload(livePic,"F:/file");
        String IdCardFront_url = OSSBootUtil.upload(IdCardFront,"F:/file");
        Map<String, String> map = new HashMap<>();//正面

        map.put("IdCardFront",IdCardFront_url);
        map.put("IdCardBank",IdCardBank_url);
        map.put("LivePic",livePic_url);



        return map;
    }
}
